<?php
 
if(empty($_GET["id"])) {
	include('top.php');
	?>
	<table width="100%" align="center">
	<tr><td width="80%">&nbsp;</td><td align="center"><a href="delsaux2.php?id=printen" target="_blank"><img src="img/printer.png" width="48" height="48" alt="print" /></a></td></tr>
	<tr><td width="80%">&nbsp;</td><td align="center"><?php echo "<b>$printvriendelijk[$taal]</b>";?></td></tr>
	</table>
<?php
}
else {
	include_once('printstyle.php');
}
require_once('pasmy/dbwaarden.php');

?>

<h3><div style="text-align: center"><a href="delsaux2.php#toevoegen" class="linkblue"><?php echo $ztoevoegen[$taal];?></a></div></h3>

<?php
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);

if(isset($_POST["toevoegen"])) {
	if(empty($_POST["delkm"])) {$geenkm[1] = $geenkilometer[$taal];}
	if(empty($_POST["ville"])) {$geenkm[2] = $geenstad[$taal];}
	if(empty($_POST["zip"])) {$geenkm[3] = $geenzip[$taal];}
	
	if(!empty($geenkm)) {
		?>
		<div style="text-align: center"><font size="+8" color="#FF0000">Attention !</font></div><br /><br /><br />
		<table align="center" width="50%">
		<tr>
		<?php
		foreach($geenkm as $value) {
			echo "<td><b>$value</b><td></tr><tr>";
			}
		?>
		</tr>
		</table>
		<?php
		exit;
		}
	$_POST["zip"] = $_POST["landkeuze"] . $_POST["zip"];
	//$sql = "insert into delkm (`km`,`plaats`,`zip`) VALUES ('$_POST[delkm]','$_POST[ville]','$_POST[zip]'";
	$sql = "INSERT INTO `delkm` (`km`, `plaats`, `zip`) VALUES ('$_POST[delkm]', '$_POST[ville]', '$_POST[zip]');";
	$res = mysql_query($sql, $mysql_id);
	$fout = mysql_errno($mysql_id);
	if($fout != 0) {
		$fout = mysql_error($mysql_id);
		echo '<div style="text-align: center"><h3><font color = "#FF2306">' . $fout . '</font></h3></div>';
		mysql_close($mysql_id);
		echo '</body></html>';
		exit;
	
	}
}
/*foreach($_POST as $sleutel => $waarde) {
		echo "sleutel = $sleutel en waarde = |$waarde| <br>";
		}*/
$kilometers=array("-----","1-50","51-120","121-200","201-280","281-350");
?>


<table width="80%" align="center" border="1">
<tr><td colspan="8" bgcolor="orange"><div style="text-align: center"><strong><font size="4"><?php echo $pprijz[$taal];?> Vanzeveren</font></strong></div></td>
</tr>
<tr>
<td class="delsaux2"><div style="text-align: center"><strong><?php echo $afstand[$taal];?></strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>1 pal&nbsp;&nbsp;(0.80m)</strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>2 pal&nbsp;&nbsp; (1.00m)</strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>3 pal &nbsp;&nbsp;(1.20m)</strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>4-8 pal &nbsp;&nbsp;(>1.20 - 3.20m)</strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>9-16 pal &nbsp;&nbsp;(> 3.20 - 6.40m)</strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>17-21 pal &nbsp;&nbsp;(> 6.40 - 8.40m)</strong></div></td>
<td class="delsaux2"><div style="text-align: center"><strong>22-24 pal &nbsp;&nbsp;(> 8.40 - 9.60m)</strong></div></td>
<!-- <td><div style="text-align: center"><strong></strong></div></td> -->

</tr>
<?php
$sql = "SELECT * FROM delsaux2";
$res = mysql_query($sql, $mysql_id);
while ($row = mysql_fetch_row($res)) {
	
	echo "<tr bgcolor='$row[8]'><td><div style=\"text-align: left\"><strong>$row[0]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[1]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[2]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[3]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[4]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[5]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[6]</strong></div></td>";
	echo "<td><div style=\"text-align: center\"><strong>$row[7]</strong></div></td></tr>";
	}
mysql_free_result($res);
echo "</table>\n<br /><br />";
include('zones.php');
if(empty($_GET["id"])) {
?>
<br /><h3><div style="text-align: center"><a name="toevoegen"><?php echo $ztoevoegen[$taal];?></a></div></h3>
<table>
<form action="delsaux2.php" method="post">
<tr>
<td><strong><?php echo $kmafstand[$taal];?></strong></td><td><input type="text" name="delkm" size="5" maxlength="5" /></td>
</tr>
<tr>
<td><strong><?php echo $plaats[$taal];?></strong></td><td><input type="text" name="ville" size="25" maxlength="80" /></td>
</tr>
<tr>
<td><strong><?php echo $postcode[$taal];?>&nbsp;&nbsp;<input type="radio" name="landkeuze" value="B-" checked="checked" />
<img src="img/bevlag.jpg" width="24" height="15" alt="frvlag" /><input type="radio" name="landkeuze" value="F-" />
<img src="img/frvlag.jpg" width="24" height="15" alt="frvlag" />&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
<td><input type="text" name="zip" size="6" maxlength="10" /></td>
</tr>
<tr>
<td colspan="2"><br /><div style="text-align: center"><input type="submit" name="toevoegen" value="<?php echo $toevoegen[$taal];?>" /></div></td>
</tr>
</form>
</table>

<?php
}
include('footer.php');
?>